package com;

import com.utils.MutilFileBakUtil;

import java.io.File;
import java.io.IOException;

public class FIleControll {
    static public void main(String[] argv) {
        String dirname = "ding";
        String filename = "aa.log";
        String path = "/Users/apple/Desktop/androidstudio_workspace/mainTest/lib/" + dirname;

        File fileOld = new File(path + "/" + filename);

        if (fileOld.exists()) {//需要备份文件时
            System.out.println("exit " + fileOld.getPath());
            MutilFileBakUtil.multiBakLogic(filename, path, fileOld, 3);
        }

        File file = new File(path);
        if (!file.exists()) {
            if (file.mkdir()) {
                System.out.println("create " + file.getName());
            }
        }

        try {
            File filepath = new File(path + "/" + filename);
            if (!filepath.exists()) {
                if (filepath.createNewFile()) {
                    System.out.println("create " + filepath.getName());
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


}
